package com.cdream.basic.algorithm.leetcode.dp;

public class Question62 {
    private int count = 0;

    public int uniquePaths(int m, int n) {
        int[][] fs = new int[m][n];
        fs[0][0] = 1;
        for (int i = 0; i < m; i++) {
            fs[i][0] = 1;
        }
        for (int i = 0; i < n; i++) {
            fs[0][i] = 1;
        }

        for (int i = 1; i < m; i++) {
            for (int j = 1; j < n; j++) {
                fs[i][j] = fs[i - 1][j] + fs[i][j - 1];
            }
        }
        return fs[m-1][n-1];
    }

    private void move(int x, int y, int m, int n) {
        if (x > m || y > n) {
            return;
        }
        if (x == m || y == n) {
            count++;
            return;
        }
        move(x + 1, y, m, n);
        move(y + 1, y, m, n);
    }
}
